Skip to content

fix: add Playwright Chromium libraries on Linux - #2171

Merged
shunkakinoki merged 1 commit into
mainfrom
codex/fix-playwright-linux-libraries
Jul 28, 2026
Merged

fix: add Playwright Chromium libraries on Linux#2171
shunkakinoki merged 1 commit into
mainfrom
codex/fix-playwright-linux-libraries

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • install nspr and nss in the shared Linux Home Manager package set
  • expose both library directories through LD_LIBRARY_PATH in Bash, Zsh, and Fish

Root cause

playwright-chromium downloads a foreign Chromium binary, but the existing Linux native-library configuration only covered the libraries required by Bun-installed Node addons. Chromium therefore could not resolve libnspr4.so and would subsequently have failed on NSS.

Impact

Managed Linux environments including Kyber, Pod, generic Ubuntu, and Matic can resolve the NSPR and NSS libraries when launching Playwright Chromium.

Validation

  • make nix-format-check
  • make shell-test — 1,725 ShellSpec examples and 420 Fish tests passed
  • evaluated the x86_64-linux Home Manager package sets for Kyber, Pod, generic Ubuntu, and Matic and confirmed both packages are present
  • evaluated generated Bash, Zsh, and Fish configuration and confirmed both library paths are exported

A complete Linux activation derivation was not cross-built locally because this host is aarch64-darwin and the existing obsidian-headless wrapper requires an x86_64-linux builder; the affected Linux package and shell options evaluated successfully.


Summary by cubic

Fix Playwright Chromium startup on Linux by installing nspr and nss and exporting their libs in shell configs. Managed Linux environments can now run playwright-chromium without NSPR/NSS errors.

  • Bug Fixes
    • Added nspr and nss to the shared Linux Home Manager package set.
    • Exported their library paths in LD_LIBRARY_PATH for Bash, Zsh, and Fish.
    • Validated with shell tests and by evaluating Linux package sets and shell configs.

Written for commit cc2f938. Summary will update on new commits.

Review in cubic

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a91128b-d207-435d-b8e2-b3e8ea35b2eb

📥 Commits

Reviewing files that changed from the base of the PR and between 79f2a19 and cc2f938.

📒 Files selected for processing (4)
  • home-manager/packages/default.nix
  • home-manager/programs/bash/default.nix
  • home-manager/programs/fish/default.nix
  • home-manager/programs/zsh/default.nix

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added NSPR and NSS libraries to the Linux package environment.
    • Updated Bash, Fish, and Zsh configurations to expose required library paths for improved application compatibility.
  • Bug Fixes

    • Improved dynamic library discovery across supported Linux shells while preserving existing library path settings.

Walkthrough

Linux package selection now includes nspr and nss, and shell initialization updates library path exports across Bash, Fish, and Zsh.

Changes

Linux library path configuration

Layer / File(s) Summary
Linux package availability
home-manager/packages/default.nix
The Linux package list adds nspr and nss.
Shell library path exports
home-manager/programs/bash/default.nix, home-manager/programs/fish/default.nix, home-manager/programs/zsh/default.nix
Linux shell environment setup updates LD_LIBRARY_PATH construction for Bash, Fish, and Zsh while retaining existing library paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: bug

Poem

A rabbit hops through paths so bright,
NSPR and NSS join the night.
Bash, Fish, Zsh all agree,
Their libraries flow wild and free.
“Hop!” says the bun, “the linker’s right!”

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-playwright-linux-libraries

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mesa-dot-dev

mesa-dot-dev Bot commented Jul 28, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixes Playwright Chromium launch issues on Linux by installing nspr and nss and exposing their library directories in LD_LIBRARY_PATH across Bash, Zsh, and Fish.

What changed?

  • home-manager/packages/default.nix: Added the nspr and nss packages to the shared Linux package configuration list.
  • home-manager/programs/bash/default.nix: Appended NSPR and NSS library directories (${pkgs.nspr}/lib and ${pkgs.nss}/lib) to the exported LD_LIBRARY_PATH.
  • home-manager/programs/fish/default.nix: Added NSPR and NSS library paths to LD_LIBRARY_PATH for the Fish shell.
  • home-manager/programs/zsh/default.nix: Appended NSPR and NSS library paths to the exported LD_LIBRARY_PATH in Zsh config.

Root cause

playwright-chromium downloads a foreign Chromium binary, but the existing Linux native-library configuration only covered the libraries required by Bun-installed Node addons. Chromium therefore could not resolve libnspr4.so and would subsequently have failed on NSS.

Impact

Managed Linux environments including Kyber, Pod, generic Ubuntu, and Matic can resolve the NSPR and NSS libraries when launching Playwright Chromium.

Validation

  • make nix-format-check
  • make shell-test — 1,725 ShellSpec examples and 420 Fish tests passed
  • evaluated the x86_64-linux Home Manager package sets for Kyber, Pod, generic Ubuntu, and Matic and confirmed both packages are present
  • evaluated generated Bash, Zsh, and Fish configuration and confirmed both library paths are exported

A complete Linux activation derivation was not cross-built locally because this host is aarch64-darwin and the existing obsidian-headless wrapper requires an x86_64-linux builder; the affected Linux package and shell options evaluated successfully.

Description generated by Mesa. Update settings

@shunkakinoki
shunkakinoki marked this pull request as ready for review July 28, 2026 06:49
@indent-zero

indent-zero Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
PR Summary

Adds NSPR/NSS to the Linux Home Manager profile and exposes them via LD_LIBRARY_PATH in bash, zsh, and fish so Playwright's downloaded Chromium binary can resolve libnspr4.so / libnss3.so. Scope is narrow and mirrors the existing pattern used for glib, libsecret, alsa-lib, etc.

  • home-manager/packages/default.nix: add nspr and nss under the stdenv.isLinux package list.
  • home-manager/programs/bash/default.nix: prepend ${pkgs.nspr}/lib and ${pkgs.nss}/lib to LD_LIBRARY_PATH in both bashrcExtra and profileExtra.
  • home-manager/programs/zsh/default.nix: same NSPR/NSS additions inside the Linux LD_LIBRARY_PATH export.
  • home-manager/programs/fish/default.nix: same NSPR/NSS additions in the fish Linux block.

Issues

3 potential issues found:

  • nspr and nss don't need to be in home.packages — they ship no user-facing binaries and the ${pkgs.nspr}/lib/${pkgs.nss}/lib interpolation in the shell configs already realises them into the store. Removing them from home-manager/packages/default.nix keeps the profile lean without changing behaviour. → Autofix
  • Playwright Chromium likely still fails after this PR: NSPR/NSS unblock libnspr4.so/libnss3.so, but the downloaded Chromium binary also typically needs libatk-1.0, libatk-bridge-2.0, libcups, libdbus-1, libdrm, libgbm, libxkbcommon (and libgtk-3 for headed). Consider adding those to LD_LIBRARY_PATH too, or switching to pkgs.playwright-driver.browsers which bundles a working Chromium with all deps. → Autofix
  • Comment above the LD_LIBRARY_PATH exports in all three shells still says "Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)" — update it to mention Playwright/Chromium so the reason nspr/nss are on the list is discoverable at the point of use. → Autofix

CI Checks

Waiting for CI checks...


⚡ Autofix All Issues

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@mesa-dot-dev

mesa-dot-dev Bot commented Jul 28, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@shunkakinoki
shunkakinoki merged commit 25e9c7a into main Jul 28, 2026
35 checks passed
@shunkakinoki
shunkakinoki deleted the codex/fix-playwright-linux-libraries branch July 28, 2026 06:49

# Native libraries for bun-installed packages (e.g. @oh-my-pi/pi-natives, sharp, keytar)
export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${lib.optionalString pkgs.stdenv.isLinux "${pkgs.alsa-lib}/lib:"}${pkgs.glib.out}/lib:${pkgs.libsecret}/lib:${pkgs.nspr}/lib:${pkgs.nss}/lib:${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely-insufficient library set for Playwright Chromium (latent)

Adding nspr and nss here resolves the immediate libnspr4.so / libnss3.so errors called out in the PR description, but Playwright's downloaded Chromium binary usually pulls in additional runtime deps that are still missing from this LD_LIBRARY_PATH:

  • libatk-1.0.so.0 (atk)
  • libatk-bridge-2.0.so.0 (at-spi2-atk)
  • libcups.so.2 (cups)
  • libdbus-1.so.3 (dbus)
  • libdrm.so.2 (libdrm)
  • libgbm.so.1 (mesa)
  • libxkbcommon.so.0 (libxkbcommon)
  • libgtk-3.so.0 (gtk3, headed mode only)

Once Chromium loads NSS successfully it will typically fail on the next missing library. You can verify with ldd node_modules/playwright-core/.local-browsers/chromium-*/chrome-linux/chrome | grep 'not found' on a Linux host.

Cleaner alternative: pkgs.playwright-driver.browsers bundles a working Chromium with all system deps and is usually what nixpkgs users reach for. If you want to keep the LD_LIBRARY_PATH approach, add the packages above so the fix is complete for typical launch() / page.goto flows.

The same comment applies to programs/bash/default.nix:124, programs/zsh/default.nix:54, and programs/fish/default.nix:33.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant